home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Linux
/
Kubuntu 8.10
/
kubuntu-8.10-desktop-i386.iso
/
casper
/
filesystem.squashfs
/
usr
/
bin
/
bf_copy
< prev
next >
Wrap
Text File
|
2008-06-18
|
1KB
|
60 lines
#! /bin/sh
# bf_copy [-c] source_dir dest_dir
#
# use to copy wordlist.db and related files
# from one directory to another
# $Id: bf_copy.in 5906 2005-05-08 20:09:53Z m-a $
set -e # die on errors
COMPACT=0
while test "$1" ; do
case "$1" in
-c) COMPACT=1 ;;
--) shift ; break ;;
-*) echo "unknown option $1" >&2 ; exit 1 ;;
*) break;
esac
shift
done
if [ $# -ne 2 ] ; then
echo 'usage: bf_copy [-c] source_dir dest_dir'
echo " use -c to copy active logs, not all"
exit 1
fi
SRC="$1"
DST="$2"
# flush mempools
bogoutil --db-checkpoint="$SRC" || :
mkdir "$DST"
TMP=bfc.$$.unneeded
rm -f $TMP
trap "rm -rf $TMP \"$DST\"" 0
if test $COMPACT -eq 1 ; then
# don't copy unneeded logs
bogoutil --db-list-logfiles="$SRC" >$TMP
else
: >$TMP
fi
# XXX FIXME - use Berkeley DB environment probing here
LOGS=`ls "$SRC"/log.* 2>/dev/null | grep -v -F -f $TMP || :`
if test "$LOGS" ; then cp -p $LOGS "$DST" ; fi
if test -f "$SRC"/DB_CONFIG ; then cp -p "$SRC"/DB_CONFIG "$DST" ; fi
for FILE in "$SRC"/*.db ; do
SIZE=`bogoutil --db-print-pagesize="$FILE"`
dd bs=$SIZE if=$FILE of="$DST/"`basename "$FILE"`
done
if test "$LOGS" ; then bogoutil --db-recover="$DST" ; fi
rm -f $TMP
trap - 0